home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / kuaqe2.zip / FLAME.QC < prev    next >
Text File  |  1996-10-06  |  6KB  |  224 lines

  1. /*
  2. ============================================================================
  3.  
  4. Quake Flamethrower 1.0
  5.  
  6. Another groovy patch from Quake Command - http://www.nuc.net/quake
  7.  
  8. QC Code By : Steve Bond         wedge@nuc.net
  9.  
  10. Apologies in advance... I was unable to comment this as well as I'd have
  11. liked to. (I used some weird variable names - hope they don't cause problems.
  12.  
  13. ============================================================================
  14. */
  15.  
  16. // Internal declaration
  17.         void (vector fireorg) SpawnTouchFlame;
  18.         void () BurnThem;
  19.  
  20. // Player.qc declaration
  21.         void () DeathBubblesSpawn;
  22.  
  23.  
  24.  
  25. // Slightly varied version of DEATHBUBBLES
  26. void(float num_bubbles, vector bub_origin) NewBubbles =
  27. {
  28. local entity    bubble_spawner;
  29.     
  30.     bubble_spawner = spawn();
  31.         setorigin (bubble_spawner, bub_origin);
  32.     bubble_spawner.movetype = MOVETYPE_NONE;
  33.     bubble_spawner.solid = SOLID_NOT;
  34.     bubble_spawner.nextthink = time + 0.1;
  35.  
  36.         if (self.classname == "player")
  37.                 bubble_spawner.owner = self;
  38.         else
  39.                 bubble_spawner.owner = self.firewood;
  40.  
  41.         bubble_spawner.think = DeathBubblesSpawn;
  42.     bubble_spawner.bubble_count = num_bubbles;
  43.     return;
  44. };
  45.  
  46.  
  47. /*
  48. ===============
  49. BurnSelf 
  50. ===============
  51. */
  52. void () BurnSelf =
  53. {
  54.         local entity    flame;
  55.  
  56.         flame = spawn ();
  57.         flame.owner = self;
  58.         flame.movetype = MOVETYPE_FLYMISSILE;
  59.         flame.velocity = '0 0 75';
  60.         flame.solid = SOLID_NOT;
  61.         flame.classname = "fire";
  62.         flame.origin = self.origin;
  63.         self.onfire = TRUE;
  64.         flame.firewood = self;
  65.         flame.think = BurnThem;
  66.         flame.nextthink = time;
  67.         setmodel (flame, "progs/s_explod.spr");
  68.         setsize (flame, '0 0 0', '0 0 0');            
  69. };
  70.  
  71. /*
  72. ===============
  73. Burn Them!
  74. ===============
  75. */
  76. void () BurnThem =
  77. {
  78.         if (self.firewood.onfire == FALSE)
  79.         {
  80.                 self.firewood.effects = self.firewood.effects - EF_DIMLIGHT;
  81.                 remove (self);
  82.                 return;
  83.         }
  84.         // CHECK FOR WATER *FIRST*
  85.         if (self.firewood.waterlevel >= 1)
  86.         {
  87.                 NewBubbles(6,self.firewood.origin);
  88.                 self.firewood.onfire = FALSE;
  89.                 self.firewood.effects = self.firewood.effects - EF_DIMLIGHT;
  90.                 remove(self);
  91.                 return;
  92.         }
  93.         else if (self.firewood.health > 0)
  94.         {
  95.                 SpawnTouchFlame(self.firewood.origin);
  96.                 T_Damage (self.firewood, self, self.owner, 1);
  97.                 self.nextthink = time + 0.25;
  98.         }
  99.         else if (self.firewood.health <= 0)
  100.                 self.firewood.effects = self.firewood.effects - EF_DIMLIGHT;
  101. };
  102.  
  103.  
  104. /*
  105. ================
  106. SpawnTouchFlame
  107. ================
  108. */
  109.  
  110. void (vector fireorg) SpawnTouchFlame =
  111. {
  112.         local entity    flame;
  113.         local   float   rn;
  114.  
  115.         flame = spawn ();
  116.         flame.owner = self;
  117.         flame.movetype = MOVETYPE_FLYMISSILE;
  118.         flame.velocity = '0 0 75';
  119.         flame.solid = SOLID_NOT;
  120.         flame.classname = "fire";
  121.         flame.origin = fireorg;
  122.         flame.think = s_explode1;
  123.         flame.nextthink = time;
  124.         setmodel (flame, "progs/s_explod.spr");
  125.         setsize (flame, '0 0 0', '0 0 0');            
  126. };
  127.  
  128. /*
  129. ================
  130. FlameTouch
  131. ================
  132. */
  133. void () FlameTouch =
  134. {
  135.         local   float   rn;
  136.  
  137.         if (other == self.owner)
  138.                 return;
  139.  
  140.         if (other.takedamage)
  141.         {
  142.                 rn = random();
  143.                 // 20% chance
  144.                 if (rn <= 0.2 && !other.onfire)
  145.                 {
  146.                         // Fire stays with whatever it hits
  147.                         if (other.classname == "player")
  148.                         {
  149.                                 centerprint(other,"You are on fire! Find WATER!\n");
  150.                                 stuffcmd (other,"bf\n");
  151.                         }
  152.                         other.onfire = TRUE;
  153.                         self.firewood = other;
  154.                         self.think = BurnThem;
  155.                         self.nextthink = time;
  156.                         self.solid = SOLID_NOT;
  157.                         setmodel (self,"");
  158.                         other.effects = other.effects | EF_DIMLIGHT;
  159.                 }
  160.                 else
  161.                 {
  162.                         SpawnTouchFlame(other.origin);
  163.                         T_Damage (other, self, self.owner, 10 );
  164.                         remove (self);
  165.                 }
  166.         }
  167.         else if (other.classname == "worldspawn")
  168.         {
  169.                 self.velocity = '0 0 0';
  170.         }
  171. };
  172.  
  173. /*
  174. ================
  175. W_FireFlame
  176. ================
  177. */
  178. void() W_FireFlame =
  179. {
  180.         local   entity flame;
  181.         local   float rn;
  182.  
  183.         if (self.waterlevel > 2)
  184.         {
  185.                 makevectors (self.v_angle);
  186.                 NewBubbles(2, self.origin+v_forward*64);
  187.  
  188.                 rn = random();
  189.                 if (rn < 0.5)
  190.                         sound (self, CHAN_WEAPON, "misc/water1.wav", 1, ATTN_NORM);
  191.                 else
  192.                         sound (self, CHAN_WEAPON, "misc/water2.wav", 1, ATTN_NORM);
  193.  
  194.                 return;
  195.         }
  196.  
  197.         // Take away a shell
  198.         self.currentammo = self.ammo_shells = self.ammo_shells - 1;
  199.  
  200.         sound (self, CHAN_WEAPON, "hknight/hit.wav", 1, ATTN_NORM);
  201.  
  202.         flame = spawn ();
  203.         flame.owner = self;
  204.         flame.movetype = MOVETYPE_FLYMISSILE;
  205.         flame.solid = SOLID_BBOX;
  206.         flame.classname = "fire";
  207.         
  208. // set flame speed    
  209.  
  210.     makevectors (self.v_angle);
  211.  
  212.                 flame.velocity = aim(self, 10000);
  213.                 flame.velocity = flame.velocity * 300;
  214.  
  215.         flame.touch = FlameTouch;
  216.     
  217.         flame.think = s_explode1;
  218.         flame.nextthink = time + 0.15;
  219.  
  220.         setmodel (flame, "progs/s_explod.spr");
  221.         setsize (flame, '0 0 0', '0 0 0');            
  222.         setorigin (flame, self.origin + v_forward * 16 + '0 0 16');
  223. };
  224.